import java.util.Scanner;

public class P5727 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int []arr = new int[1000];
        int i=0;

        while (n>=1) {
            arr[i++]=n;
            if (n==1){
                break;
            }
            if (n % 2 == 0) {
                n /= 2;
            }
            else {
                n=n*3+1;
            }

        }
        for (int j=i-1;j>=0;j--){
            System.out.print(arr[j]+" ");
        }
    }
}